import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:top_foundation/component/dialog/dialog/index.dart';
import 'package:top_foundation/component/dialog/index.dart';
import 'package:top_foundation/utils/theme/theme.dart';
import 'package:top_foundation/utils/util.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class DialogDemoPage extends GetView<DialogDemoController> {
  const DialogDemoPage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    var state = controller.state;
    return Column(
      children: [
        SelectTagView(
          initIndexs: state.selectedIndexs,
          items: List.generate(8, (index) => '第$index个'),
          selectedTagBgColor: ITheme.themeColor,
          selectedTextStyle: TextStyle(color: Colors.white, fontSize: 15.sp),
          onTap: (p0) {
            state.selectedIndexs = p0;
            controller.update();
          },
        ),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<DialogDemoController>(
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("select tag")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
